package com.wn.sddfp.system.controller;

import cn.hutool.core.util.RandomUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yellow Docter
 * @date 2024-08-02
 * @desc 蜗牛创想：www.woniuxy.com
 */
@RefreshScope   //动态 的刷新配置
@RestController
@RequestMapping("test")
public class TestController {

    @Value("${server.port}")
    private Integer port;

//    @Value("${test.title}")
//    private String title;
//
//    @GetMapping("/demo01")
//    public String demo01(){
//
//        return "动态修改:" + title;
//
//    }

    @GetMapping("/find/{id}")
    public String test(@PathVariable("id") Integer id){

        System.out.println("id = " + id);
        String code = RandomUtil.randomNumbers(4);
        return code + ":" + id + ":port = " + port;

    }

}
